package cn.web.web_module.controller;

import cn.itcast.util.ResponseEntity;
import cn.message.service.impl.HorsemanServiceImpl;
import cn.web.web_module.service.HorsemanPayService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Author: 张松
 * @Description:
 * @Date: Created in 14:22 2020/11/25
 * @Modified By:
 */
@RestController
@RequestMapping("/pay")
public class HoresmanPayController {

    @Autowired
    private HorsemanPayService horsemanPayService;

    @PostMapping("PayByOrder")
    public ResponseEntity PayByOrder(@RequestBody Map<String,String> map){
        Integer orderId = Integer.parseInt(map.get("orderId"));
        String openId = map.get("openId");
        Double price = Double.parseDouble(map.get("price"));
        ResponseEntity responseEntity = horsemanPayService.PayByOrder(orderId, openId, price);
        return responseEntity;
    }
}
